#ifdef TIME_5_SKIP
#else
#include "view_time_5.h"
#include "view_time_5.inc"
#include "view_time_0.h"
#include "display_ctrl.h"
#include "platform_assert.h"
#include "lfs_file_manager_auto.h"
#include "rtc.h"
#include "datetime.h"
#include "blecom.h"
#include "battery_ctrl.h"
#include "sport_his.h"
#include "display_ctrl.h"
#include "display_interface_240x240.h"
#include "datetime.h"
#include "heart_rate_interface.h"
#include "font/num_font.h"
#include "font_mngr.h"
#include "view_common.h"
#include "app_trace.h"
#include "weather_ctrl.h"
#include "view_times.h"

static void show_percent(int x, int y, int current, int goal
                         //, int temp_index_start
)
{
    int percent = 0;
#if 0
#warning debug
    current = 87;
    goal = 100;
#endif
    if (goal > 0 && current > 0)
    {
        percent = current * 100 / goal;
        if (percent < 0)
        {
            percent = 0;
        }
        else if (percent > 100)
        {
            percent = 100;
        }
    }
    disp_draw_user_image_percent_circle(x, y, ring_full, percent, 21);
    // user_cycle_percent_param_t const param = {
    //     .base = ring_full,
    //     .transparent_color = RGB565_COLOR_BLACK,
    //     .full_color = RGB565_COLOR_BLACK,
    //     .empty_color = RGB565_COLOR_WHITE,
    //     .x = x,
    //     .y = y,
    //     .target_num = goal,
    //     .presently_num = current,
    //     .temp_0 = &disp_ctrl.com_data.i_temp[temp_index_start],
    //     .temp_1 = &disp_ctrl.com_data.i_temp[temp_index_start + 1],
    //     .temp_2 = &disp_ctrl.com_data.f_temp[temp_index_start + 2],
    //     .temp_3 = &disp_ctrl.com_data.i_temp[temp_index_start + 3],
    //     .temp_4 = &disp_ctrl.com_data.i_temp[temp_index_start + 4],
    //     .line_width = 4,
    // };
    // disp_draw_user_image_cycle_percent(param);
}
void view_time_5_display(void)
{
    _disp_show_flash_img(DISP_LFS_FILE_INDEX_0, 0, 0, FILE_IMG_time_5_back);
    show_time_0_ble();
    show_time_0_battery(disp_ctrl.com_data.i_temp[7], disp_ctrl.com_data.i_temp[8]);
    _disp_show_flash_img(DISP_LFS_FILE_INDEX_1, 77, 38, FILE_IMG_6102_jan_77_38 + disp_ctrl.com_data.i_temp[1] - 1);
    disp_draw_user_image_num_with_digits(137, 38, disp_ctrl.com_data.i_temp[2], 2, 12 + 5, num_12x18_TAB);
    // disp_draw_rect_color(119, 85, 119 + 5 - 1, 86 + 5 - 1, RGB565_COLOR_WHITE);
    // disp_draw_rect_color(119, 105, 119 + 5 - 1, 105 + 5 - 1, RGB565_COLOR_WHITE);
    disp_draw_user_image_num_with_digits(49, 75, disp_ctrl.com_data.i_temp[3], 2, 25 + 8, num_25x37_TAB);
    disp_draw_user_image_num_with_digits(136, 75, disp_ctrl.com_data.i_temp[4], 2, 25 + 8, num_25x37_TAB);
    int max_heart_rate = 220 - system_config_get_age();
    int min_heart_rate = 40;
    show_percent(147, 129, disp_ctrl.com_data.i_temp[17] - min_heart_rate, max_heart_rate - min_heart_rate);
    show_percent(95, 170, disp_ctrl.com_data.i_temp[11], system_config_get_target_step());
    show_percent(42, 129, disp_ctrl.com_data.i_temp[16], system_config_get_target_calorie());
}
#endif
